home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / tcoop.arc / TCOOP2.ARC / GWSOUNIT.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1991-10-26  |  2.1 KB  |  81 lines

  1. // gwsounit.cpp:
  2. // Provides graphics screen objects based on the Iso type. In particular,
  3. // this type overrides the prompting and moving methods in order to
  4. // implement them according to the specifics of graphics mode. 
  5.  
  6. #include "gwsounit.h"
  7.  
  8. Wso::Wso(int Ba, int Fa, ColorPak &Cp)
  9. // Initializes a Wso object as a Gfso object passed to Iso 
  10. : Iso(new Gfso(Ba, Fa, Cp))
  11. {
  12.   return; 
  13. }
  14.  
  15. void Wso::MoveLoop(MsgPkt &M)
  16. // Moves a Swappable object by using a skeleton if the OutlineMove
  17. // bit is set. Otherwise the object is moved by swapping the image
  18. // in and out of screen memory. 
  19. {
  20.   Gskel *Red;
  21.   Iso   *Skeleton;
  22.   ColorPak C;
  23.  
  24.   if (Panel->IsSwappable()) {
  25.      if ((Panel->Fattr & OutlineMove) != 0) {
  26.        C = MonoColors;
  27.        C.Bc = 0xff;  // Use white for border color for XOR lines 
  28.        Red = new Gskel(C);
  29.        Red->SetSize(Panel->Frame->Wd, Panel->Frame->Ht);
  30.        Skeleton = new Iso(Red); // Make a skeleton Iso
  31.        Skeleton->Open(Base, 
  32.                       Panel->Frame->Xul-Base->Panel->Interior->Xul,
  33.                       Panel->Frame->Yul-Base->Panel->Interior->Yul);
  34.        Skeleton->MoveLoop(M);
  35.        Skeleton->Remove();
  36.        if ((Panel->Frame->Xul != Skeleton->Panel->Frame->Xul) ||
  37.            (Panel->Frame->Yul != Skeleton->Panel->Frame->Yul)) 
  38.            Move(Skeleton->Panel->Frame->Xul, 
  39.                Skeleton->Panel->Frame->Yul);
  40.        delete Skeleton;
  41.      }
  42.      else Iso::MoveLoop(M); // Just move whole window around
  43.   }
  44. }
  45.  
  46. void Wso::Prompt()
  47. // Graphics mode prompting is accomplished by redrawing the frame of
  48. // the object using the prompt color, Pc. 
  49. {
  50.   Iso::Prompt();
  51.   if ((Panel->Bstyle > 0) &&
  52.       ((Panel->Fattr & BorderPrompt) != 0))
  53.       Panel->DrawFrame(0, Panel->Colors.Pc);
  54. }
  55.  
  56. void Wso::UnPrompt(void)
  57. // Restores the object's border by redrawing it using its default colors 
  58. {
  59.   if (Active) {
  60.      if ((Panel->Bstyle > 0) && ((Panel->Fattr & BorderPrompt) != 0))
  61.          Panel->DrawFrame(0, 0);  // 0, 0 means use default 
  62.      Iso::UnPrompt();
  63.   }
  64. }
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.